<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Tell whether a day is a weekday, weekend or a day that has a transition between the two</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="intlcalendar.getavailablelocales.html">« IntlCalendar::getAvailableLocales</a></li>
      <li style="float: right;"><a href="intlcalendar.geterrorcode.html">IntlCalendar::getErrorCode »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.intlcalendar.html">IntlCalendar</a></li>
    <li>Tell whether a day is a weekday, weekend or a day that has a transition between the two</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="intlcalendar.getdayofweektype" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">IntlCalendar::getDayOfWeekType</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.5.0, PHP 7, PHP 8, PECL &gt;= 3.0.0a1)</p><p class="refpurpose"><span class="refname">IntlCalendar::getDayOfWeekType</span> &mdash; <span class="dc-title">Tell whether a day is a weekday, weekend or a day that has a transition between the two</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-intlcalendar.getdayofweektype-description">
  <h3 class="title">说明</h3>
  <p class="para">
   面向对象风格
  </p>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>IntlCalendar::getDayOfWeekType</strong></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$dayOfWeek</code></span>): <span class="type"><span class="type">int</span>|<span class="type"><span class="type false">false</span></span></span></div>

  <p class="para rdfs-comment">
   过程化风格
  </p>
  <div class="methodsynopsis dc-description"><span class="methodname"><strong>intlcal_get_day_of_week_type</strong></span>(<span class="methodparam"><span class="type"><a href="class.intlcalendar.html" class="type IntlCalendar">IntlCalendar</a></span> <code class="parameter">$calendar</code></span>, <span class="methodparam"><span class="type">int</span> <code class="parameter">$dayOfWeek</code></span>): <span class="type"><span class="type">int</span>|<span class="type"><span class="type false">false</span></span></span></div>

  <p class="para rdfs-comment">
   Returns whether the passed day is a weekday
   (<strong><code>IntlCalendar::DOW_TYPE_WEEKDAY</code></strong>), a weekend day
   (<strong><code>IntlCalendar::DOW_TYPE_WEEKEND</code></strong>), a day during which a
   transition occurs into the weekend
   (<strong><code>IntlCalendar::DOW_TYPE_WEEKEND_OFFSET</code></strong>) or a day during
   which the weekend ceases
   (<strong><code>IntlCalendar::DOW_TYPE_WEEKEND_CEASE</code></strong>).
  </p>
  <p class="para">
   If the return is either
   <strong><code>IntlCalendar::DOW_TYPE_WEEKEND_OFFSET</code></strong> or
   <strong><code>IntlCalendar::DOW_TYPE_WEEKEND_CEASE</code></strong>, then
   <span class="function"><a href="intlcalendar.getweekendtransition.html" class="function">IntlCalendar::getWeekendTransition()</a></span> can be called to
   obtain the time of the transition.
  </p>
  <p class="para">
   This function requires ICU 4.4 or later.
  </p>

 </div>


 <div class="refsect1 parameters" id="refsect1-intlcalendar.getdayofweektype-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt>
<code class="parameter">calendar</code></dt>

    <dd>

     <p class="para"><span class="classname"><a href="class.intlcalendar.html" class="classname">IntlCalendar</a></span> 实例。</p>
    </dd>

   
   
    <dt>
<code class="parameter">dayOfWeek</code></dt>

    <dd>

     <p class="para">
      One of the constants <strong><code>IntlCalendar::DOW_SUNDAY</code></strong>,
      <strong><code>IntlCalendar::DOW_MONDAY</code></strong>, …,
      <strong><code>IntlCalendar::DOW_SATURDAY</code></strong>.
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-intlcalendar.getdayofweektype-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns one of the constants 
   <strong><code>IntlCalendar::DOW_TYPE_WEEKDAY</code></strong>,
   <strong><code>IntlCalendar::DOW_TYPE_WEEKEND</code></strong>,
   <strong><code>IntlCalendar::DOW_TYPE_WEEKEND_OFFSET</code></strong> or
   <strong><code>IntlCalendar::DOW_TYPE_WEEKEND_CEASE</code></strong> 或者在失败时返回 <strong><code>false</code></strong>.
  </p>
 </div>



 <div class="refsect1 examples" id="refsect1-intlcalendar.getdayofweektype-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-2396">
   <p><strong>示例 #1 <span class="function"><strong>IntlCalendar::getDayOfWeekType()</strong></span></strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">foreach&nbsp;(array(</span><span style="color: #DD0000">'en_US'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'ar_SA'</span><span style="color: #007700">)&nbsp;as&nbsp;</span><span style="color: #0000BB">$locale</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"Locale:&nbsp;"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">Locale</span><span style="color: #007700">::</span><span style="color: #0000BB">getDisplayName</span><span style="color: #007700">(</span><span style="color: #0000BB">$locale</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"en_US"</span><span style="color: #007700">),&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$cal&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">IntlCalendar</span><span style="color: #007700">::</span><span style="color: #0000BB">createInstance</span><span style="color: #007700">(</span><span style="color: #DD0000">'UTC'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$locale</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;(</span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">IntlCalendar</span><span style="color: #007700">::</span><span style="color: #0000BB">DOW_SUNDAY</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">&lt;=&nbsp;</span><span style="color: #0000BB">IntlCalendar</span><span style="color: #007700">::</span><span style="color: #0000BB">DOW_SATURDAY</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">++)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$type&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$cal</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getDayOfWeekType</span><span style="color: #007700">(</span><span style="color: #0000BB">$i</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$transition&nbsp;</span><span style="color: #007700">=&nbsp;(</span><span style="color: #0000BB">$type&nbsp;</span><span style="color: #007700">!==&nbsp;</span><span style="color: #0000BB">IntlCalendar</span><span style="color: #007700">::</span><span style="color: #0000BB">DOW_TYPE_WEEKDAY</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;?&nbsp;</span><span style="color: #0000BB">$cal</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getWeekendTransition</span><span style="color: #007700">(</span><span style="color: #0000BB">$i</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;</span><span style="color: #DD0000">''</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"&nbsp;"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$type</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"&nbsp;"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$transition</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程会输出：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
Locale: English (United States)
1 1 86400000
2 0
3 0
4 0
5 0
6 0
7 1 0

Locale: Arabic (Saudi Arabia)
1 0
2 0
3 0
4 0
5 0
6 1 0
7 1 86400000
</pre></div>
    </div>
   </div>
  </p>
 </div>


</div></div></div></body></html>